<?php

class TitleAction extends Action {

    public function titles() {
        
        $titles = new Model('titles');
        $titlesCount = $titles->group('title')->Count();
        $this->assign('titlesCount', $titlesCount);

        $data = $titles->field('title, count(title) as count')->group('title')->select();
        $this->assign('titles', $data);
        $this->display();
    }
}
